<div>
<form id="new" enctype="application/x-www-form-urlencoded" action="" method="post">
    <table>
        <tr><td><?php echo $this->new->title; ?></td></tr>
        <tr>
            <td>
                <?php echo $this->new->category; ?>
                <?php echo $this->new->subcategory; ?>
            </td>
        </tr><td><?php echo $this->new->description; ?></td></tr>
        <tr><td><?php echo $this->new->name; ?></td></tr>
        <tr><td><?php echo $this->new->phone; ?></td></tr>
        <tr><td><?php echo $this->new->email; ?></td></tr>
        <tr><td><?php echo $this->new->picture; ?></td></tr>
        <tr><td><?php echo $this->new->submit; ?></td></tr>
    </table>
</form>
</div>
<script type="text/javascript">
    function getcategory(){
        $.ajax({
            url:'<?php echo $this->baseUrl(); ?>/ads/getcategory',
            dataType : "json",
            data: { category_id:$("#category").val() },
            success: function (data) {
                $("#subcategory").html('');
                $.each(data, function(i, val) {  
                    $("#subcategory").append('<option value='+i+' label='+val+'>'+val+'</option>');
                });
                $("#subcategory").css("visibility","visible");
            },
            error: function () {
                alert(data);
            }
        });
    }
</script>